package com.nowcoder.Offer.Tree;

/**
 * 判断二叉树是否是对称的
 */
public class IsSymmetricalTree {

    boolean isSymmetrical(TreeNode root) {
        return Symmetrical(root,root);
    }

    boolean Symmetrical(TreeNode roota, TreeNode rootb){
        if(roota == null && rootb == null) return true;

        if(roota == null || rootb == null) return false;

        if(roota.val == rootb.val) return true;

        return Symmetrical(roota.left,rootb.right) && Symmetrical(roota.right, rootb.left);
    }

}
